package day04;

/*
 * Author: JacksonCoder
 * FileName: ForEachDemo
 * Version: 1.0.0
 * Date: 2025/4/11
 */

import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;


public class ForEachDemo {

    public static void main(String[] args) {
        List<String> list = Arrays.asList("alen", "alex", "chris", "jack", "james", "jerry", "lucy", "lily", "tom", "tony");

        // 直接使用过滤后的 Stream
        Stream<String> stream = list.stream().filter(s -> s.startsWith("a"));
        stream.forEach(System.out::println); // 打印结果

        for(int nums = 0; nums < 5; nums++){
            if(nums == 2) continue;
            if(nums == 4) break;
            System.out.println("nums = "+ nums);
        }
    }

}
